/**
 *
 */
package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.OrderGroupMapper;
import com.ybkj.daijia.server.model.OrderGroup;
import com.ybkj.daijia.server.service.OrderGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Shine
 *
 */
@Service
public class DefaultOrderGroupService implements OrderGroupService {

    @Autowired
    private OrderGroupMapper orderGroupMapper;


    @Transactional(rollbackFor = Exception.class)
    public OrderGroup save(OrderGroup orderGroup) {

        orderGroupMapper.insertRecord(orderGroup);

        return orderGroup;
    }

    @Transactional(rollbackFor = Exception.class)
    public void update(OrderGroup orderGroup) {

        orderGroupMapper.updateByPrimaryKey(orderGroup);

    }

    public OrderGroup findOne(Long id) {

        return orderGroupMapper.selectByPrimaryKey(id);
    }

    @Transactional(rollbackFor = Exception.class)
    public void delete(OrderGroup orderGroup) {

        orderGroupMapper.deleteByPrimaryKey(orderGroup.getId());

    }


}